package com.example.mapper;

import com.example.domian.Dept;
import lombok.Data;
import org.apache.ibatis.annotations.*;

import java.util.List;


//操作部门的Mapper接口
@Mapper
public interface DeptMapper {

    //查询所有部门
    @Select("select * from dept")
    List<Dept> selectAll();

    //修改部门
    @Update("update dept set name = #{name},create_time = #{createTime},update_time = #{updateTime} where id = #{id}")
    void update(Dept dept);

    //删除部门
    @Delete("delete from dept where id = #{id}")
    void deleteById(Integer id);

    //根据id查询部门
    @Select("select * from dept where id = #{id}")
    Dept selectById(Integer id);

    //添加部门
    @Insert("insert into dept values (#{id},#{name},#{createTime},#{updateTime})")
    void add(Dept dept);
}
